<?php
header("Pragma: public");
header("Expires: 0");
header("Accept-Ranges: bytes");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/vnd.ms-excel");
header('Content-Disposition: attachment; filename=dictionary.xls');
header("Content-Transfer-Encoding: binary");

	$tmp = $xmlArray['DictionaryData']['DictionaryItems']['DictionaryItem'];
/* 	echo '<table>';
	foreach ($tmp as $element):
		echo '<tr>';
			echo '<td>'.$element['ID'].'</td>';
			echo '<td>'.$element['Name'].'</td>';
		echo '</tr>';
	endforeach;
	echo '</table>'; */

	// только для разбора xml по олимпиадам
	$tmp = $xmlArray['DictionaryData']['DictionaryItems']['DictionaryItem'];
 echo '<table>';
foreach ($tmp as $element):
echo '<tr>';
echo '<td>'.$element['OlympicID'].'</td>';
echo '<td>'.$element['OlympicNumber'].'</td>';
echo '<td>'.$element['OlympicName'].'</td>';
if (isset($element['OlympicLevelID'])) {
	echo '<td>'.$element['OlympicLevelID'].'</td>';
} else {
	echo '<td>&nbsp;</td>';
}
echo '<td>';
if (is_array($element['Subjects']/* ['SubjectID'] */)){
	$subjects = $element['Subjects']['Subject'];
	foreach ($subjects as $subject):
	echo $subject['SubjectID'].'+ ';
	endforeach;	
} else {
	//echo $element['Subjects']['SubjectID'].'+ ';
}
echo '</td>';
echo '</tr>';
endforeach;
echo '</table>';
?>	